from rest_framework import generics

from .models import Movie
from .serializers import MovieSerializer


class MovieListCreateAPIView(generics.ListCreateAPIView):
    """电影列表和创建API视图类"""

    queryset = Movie.objects.all().order_by("id")  # 查询所有电影并按ID排序
    serializer_class = MovieSerializer  # 使用电影序列化器


class MovieDetailAPIView(generics.RetrieveUpdateDestroyAPIView):
    """电影详情API视图类"""

    queryset = Movie.objects.all()  # 查询所有电影
    serializer_class = MovieSerializer  # 使用电影序列化器
